import {useEffect, useRef, useState} from "react";
import {useInViewport} from "ahooks";

const useViewOne = ()=>{
    const ref = useRef(null)
    const [view,setView] = useState<number>(0)
    const [inViewport] = useInViewport(ref)
    useEffect(()=>{
        if (inViewport && view == 0) {
            setView(() => 1)
        }
    },[inViewport, view])

}

export default useViewOne
